package com.wkbb.sports.dto;

import java.text.NumberFormat;

public class ProjectBarDto {
	
	private String name;
	
	private String projectName;
	
	private String icon;
	
	private String url;
	
	private double total;
	
	private double totalScore;
	
	public ProjectBarDto(String name, String projectName, String url, String icon){
		this.name = name;
		this.projectName = projectName;
		this.url = url;
		this.icon = icon;
	}

	public void add(double total, double totalScore) {
		this.total += total;
		this.totalScore += totalScore;
	}
	
	public String getName() {
		return this.name;
	}
	
	public String getPorjectName() {
		return this.projectName;
	}
	
	
	
	public String getIcon() {
		return icon;
	}

	public String getUrl() {
		return url;
	}

	public String getValue() {
		double value = 0;
		if(total != 0) {
			value = (totalScore / total) / 10;
		}
		NumberFormat nf = NumberFormat.getNumberInstance();
		nf.setMaximumFractionDigits(1);
		return nf.format(value);
	}
}
